package com.yyx.app1.DiagnosticTools_function.Control.ViewPager;

import android.content.Context;
import android.graphics.Color;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.yyx.app1.DiagnosticTools_function.Control.ViewPager.ViewPagerItemControl.firstControl.CommonlyUsedFormulas_View;
import com.yyx.app1.DiagnosticTools_function.Control.ViewPager.ViewPagerItemControl.firstControl.CommonlyUsedFormulas_View_;
import com.yyx.app1.DiagnosticTools_function.Control.ViewPager.ViewPagerItemControl.fourthControl.StoolRoutine_View;
import com.yyx.app1.DiagnosticTools_function.Control.ViewPager.ViewPagerItemControl.fourthControl.StoolRoutine_View_;
import com.yyx.app1.DiagnosticTools_function.Control.ViewPager.ViewPagerItemControl.secondControl.BiochemicalBloodGasAnalysis_View;
import com.yyx.app1.DiagnosticTools_function.Control.ViewPager.ViewPagerItemControl.secondControl.BiochemicalBloodGasAnalysis_View_;
import com.yyx.app1.DiagnosticTools_function.Control.ViewPager.ViewPagerItemControl.threeControl.BiochemicalSetOfInspection_View;
import com.yyx.app1.DiagnosticTools_function.Control.ViewPager.ViewPagerItemControl.threeControl.BiochemicalSetOfInspection_View_;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yuexing on 2015/9/9.
 */
public class DiagnosticTools_4function_ViewPager_Adapter extends PagerAdapter {
    private List<View> viewList;
    private Context context;

    public DiagnosticTools_4function_ViewPager_Adapter(Context context) {
        this.context = context;
    }

    public void setData()
    {
        viewList=new ArrayList<View>();
        CommonlyUsedFormulas_View commonlyUsedFormulas_view = CommonlyUsedFormulas_View_.build(context);
        viewList.add(commonlyUsedFormulas_view);
        BiochemicalBloodGasAnalysis_View bbgview = BiochemicalBloodGasAnalysis_View_.build(context);
        viewList.add(bbgview);
        BiochemicalSetOfInspection_View bsoiview = BiochemicalSetOfInspection_View_.build(context);
        viewList.add(bsoiview);
        StoolRoutine_View sv= StoolRoutine_View_.build(context);
        viewList.add(sv);
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(viewList.get(position));
        return viewList.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object)
    {
        container.removeView(viewList.get(position));
    }

    @Override
    public int getCount() {
        return viewList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }
}
